<?php //pack11class

class Page {

    public $label="";
    public $id=0;
    public $system="page";
    public $className="SimpleModule";
    public $active=false;
    public $admin=false;
    public $traceEnabled=true;

    public function setDataFromSQL($data) {
        foreach($this as $property=>$value) {
            if(array_key_exists($property, $data)) {
                $this->$property=$data[$property];
            }
            if($property=="label") {
                if(is_null($data[LanguagesManager::field()])) {
                    foreach(LanguagesManager::getLanguages() as $language) {
                        if(!is_null($data["lang".$language->id])) {
                            $this->label=$data["lang".$language->id];
                            break;
                        }
                    }
                } else {
                    $this->label=$data[LanguagesManager::field()];
                }
            }
        }
    }

    public function __toString() {
        return "Page";
    }
}
?>
